﻿using Ozone.Device;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Ozone.Views.Curve
{
    /// <summary>
    /// UCCurve.xaml 的交互逻辑
    /// </summary>
    public partial class UCCurve : UserControl
    {

        List<UCLineChart> lstCharts = new List<UCLineChart>();

        public UCCurve()
        {
            InitializeComponent();


            Init();

            lstCharts.Add(pageFlow);
            lstCharts.Add(pagePress);
            lstCharts.Add(pageTemp);
            lstCharts.Add(pageLiquidLevel);
        }

        public void SwitchCharts(int nIndex)
        {
            for(int i=0;i<lstCharts.Count;i++)
            {
                if (i == nIndex)
                    lstCharts[i].Visibility = Visibility.Visible;
                else
                    lstCharts[i].Visibility = Visibility.Collapsed;
            }
        }

         private void Init()
        {
            pageFlow.setTitle("流速曲线");
            pagePress.setTitle("压力曲线");
            pageTemp.setTitle("温度曲线");
            pageLiquidLevel.setTitle("液位曲线");

            //气体流速
            pageFlow.addLine("流量计1", "MFCFlow1", 0);
            pageFlow.addLine("流量计2", "MFCFlow2", 1);
            pageFlow.addLine("流量计3", "MFCFlow3", 2);
            pageFlow.addLine("流量计4", "MFCFlow4", 3);
            pageFlow.addLine("耐腐蚀流量计", "MFCFlow5", 4);
            pageFlow.addLine("输液泵1", "PumpFlow1", 5);
            pageFlow.addLine("输液泵2", "PumpFlow2", 6);
            pageFlow.setYRangPro(0, 100);

            //压力曲线
            pagePress.addLine("流量计1入口", "MFCPress1", 0);
            pagePress.addLine("流量计2入口", "MFCPress2", 1);
            pagePress.addLine("流量计3入口", "MFCPress3", 2);
            pagePress.addLine("流量计4入口", "MFCPress4", 3);
            pagePress.addLine("背压阀", "BPPress1", 4);
            pagePress.addLine("输液泵1", "PumpPress1", 5);
            pagePress.addLine("输液泵2", "PumpPress2", 6);
            pagePress.setYRangPro(0, 100);

            //温度
            pageTemp.addLine("预热器1", "PreheaterTemp1", 0);
            pageTemp.addLine("预热器2", "PreheaterTemp2", 1);
            pageTemp.addLine("反应器1", "ReactorTemp1", 2);
            pageTemp.addLine("反应器2", "ReactorTemp2", 3);
            pageTemp.addLine("收集罐1", "CollectionTankTemp1", 4);
            pageTemp.addLine("收集罐2", "CollectionTankTemp2", 5);
            pageTemp.setYRangPro(0, 300);

            //液位
            pageLiquidLevel.addLine("液位", "LiquidLevel", 0);
            pageLiquidLevel.setYRangPro(0, 100);

        }
    }
}
